﻿using AiQiuQuan.Sport.Model.Enums;
using System.ComponentModel.DataAnnotations;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 退款请求
    /// </summary>
    public class RefundRequestDto// : IValidatableObject
    {
        /// <summary>
        /// 业务类型：1场馆场地订单、5活动订单、6约球订单、10比赛订单
        /// </summary>
        [Required(ErrorMessage = "业务类型必填：1场馆场地订单、5活动订单、5约球订单、10比赛订单")]
        public BusinessTypeEnum BusinessType { get; set; }

        /// <summary>
        /// 业务订单ID
        /// </summary>
        [Required(ErrorMessage = "业务订单必填")]
        public Guid OrderId { get; set; }

        /// <summary>
        /// 支付单取消方式：1用户取消、2场馆取消、3平台取消
        /// </summary>
        [Required]
        public OrderCancelTypeEnum CancelType { get; set; } = OrderCancelTypeEnum.User;

        /// <summary>
        /// 退款申请金额/次数
        /// </summary>
        public decimal ApplyAmount { get; set; }

        /// <summary>
        /// 取消原因ID
        /// </summary>
        public Guid? CancelReasonID { get; set; }

        /// <summary>
        /// 取消拒绝退款备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 不同业务传的数据不同
        /// </summary>
        public string? AttachData { get; set; }

        /// <summary>
        /// 是否平台
        /// </summary>
        public bool? IsPlatform { get; set; }

        ///// <summary>
        ///// validate
        ///// </summary>
        //public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        //{
        //    //if (CancelType != OrderCancelTypeEnum.User && ApplyAmount <= 0)
        //    //{
        //    //    yield return new ValidationResult("传入金额/次数为0");
        //    //    yield break;
        //    //}
        //}
    }
}
